package com.yc.spring.bbs.dao;


import com.yc.spring.bbs.bean.User;
import org.springframework.context.annotation.Primary;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Repository;

import java.util.ArrayList;
import java.util.List;

@Component
@Primary
public class UserDaoImpl  implements UserDao {

    @Override
    public void insert(User user) {

        System.out.println("-------insert------");

    }

    @Override
    public void update(User user) {
        System.out.println("------update-----");

    }

    @Override
    public void delete(User user) {
        System.out.println("------UserDaoImpl.delete-----");

    }

    @Override
    public void selectOne(Object id) {
        int i=1/0;  //异常
        System.out.println("------UserDaoImpl.selectOne-----");
    }

    @Override
    public List<User> selectList(User user, Integer page, Integer rows) {

        System.out.println("------UserDaoImpl.selectList-----");
        return new ArrayList<>();
    }

    @Override
    public long count(User user) {
        try {
            Thread.sleep(1000);
        } catch (InterruptedException e) {
            throw new RuntimeException(e);
        }

        System.out.println("------UserDaoImpl.count-----");
        return 0;
    }
}
